package com.ykht.proj.coupon.controller.c;

import com.ykht.proj.common.core.util.R;
import com.ykht.proj.common.security.util.SecurityUtils;
import com.ykht.proj.coupon.entity.CnPerson;
import com.ykht.proj.coupon.service.FxBrandPersonService;
import com.ykht.proj.coupon.service.FxFavourService;
import com.ykht.proj.coupon.vo.FxCmsInfoVO;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * @Author: lazyBoy
 * @Date: 2021/2/19 15:47
 */
@RestController
@AllArgsConstructor
@RequestMapping("/c/setFavour")
public class ClientFxFavourController {
	private final FxFavourService fxFavourService;
	private final FxBrandPersonService fxBrandPersonService;


	/**
	 * 点赞
	 */
	@ApiOperation(value = "点赞", notes = "点赞")
	@PutMapping("/giveALike")
	public R setGiveALike(@RequestBody FxCmsInfoVO fxCmsInfoVO) {
		fxCmsInfoVO.setCreateUser(SecurityUtils.getPersonId());
		CnPerson cnPerson = new CnPerson();
		cnPerson.setId(SecurityUtils.getPersonId());
		cnPerson = cnPerson.selectById();
		/*判断用户手机号是否存在*/
		if (cnPerson.getAuthBaseStatus() == 0) {
			fxFavourService.setGiveALike(fxCmsInfoVO);
			return R.ok();
		} else {
			return R.failed("未授权微信基础信息");
		}
	}
}
